<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  Student: rj1502
  Date: 2017/10/23
  Time: 13:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>Title</title>
    <style type="text/css">
        #tj{
            width: 800px;
            height: 30px;
            font-size: 20px;
            padding-right: 50px;
            margin: 0px auto;
            text-align: right;
        }
        #tb{
            margin: 0px auto;
            text-align: center;
        }
        #search{
            width: 800px;
            height: 40px;
            text-align: center;
            margin: 5px auto;
        }
    </style>
</head>
<body>

  <h1 style="text-align: center">商品列表 </h1>
  <%--此处是个搜索框--%>
  <div style="text-align: center">
      <form action="${pageContext.request.contextPath}/searchProductServlet" method="get">
          <input type="text" name="condition" value="">
          <input type="submit" value="搜索">
      </form>
  </div>

  <hr>
  <hr>
    <div id="tj"> <a href="${pageContext.request.contextPath}/product/add.jsp">添加</a> </div>
  <table id="tb" border="1" cellspacing="0" width="800px" >

      <tr >
          <td width="80px">序号</td>
          <td width="320px">图书名称</td>
          <td width="160px">商场价格</td>
          <td width="160px">操作</td>
      </tr>
      <c:forEach var="list" items="${list}" varStatus="status">
          <c:choose>
              <c:when test="${status.count%2 == 0}">
                  <tr style="background-color: aliceblue">
              </c:when>
              <c:otherwise>
                  <tr style="background-color: darkgray">
              </c:otherwise>
          </c:choose>
          <td>${status.count}</td>
          <td>${list.pname}</td>
          <td>${list.shopprice}</td>
          <td>
              <a href="${pageContext.request.contextPath}/editUIservlet?pid=${list.pid}">修改</a>|
              <a href="" onclick="return confirm('确认删除码？？')">删除</a>
          </td>
          </tr>
      </c:forEach>

  </table>
</body>
</html>
